<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>click</title>
</head>
<body>
<a href="#" id="clickMe" onclick="alert('clicked');">link</a>
<script type="text/javascript">
    // 两秒后模拟点击
    setTimeout(function() {
        // IE
        if(document.all) {
            document.getElementById("clickMe").click();
        }
        // 其它浏览器
        else {
            var e = document.createEvent("MouseEvents");
            e.initEvent("click", true, true);
            document.getElementById("clickMe").dispatchEvent(e);
        }
    }, 2000);
</script>


</body>
</html>